//
//  CSMACAVCSListener.hpp
//  WiFiMACSim
//
//  Created by Christopher Kemsley on 4/1/12.
//  Copyright (c) 2012 iAppolopolis. All rights reserved.
//

#ifndef WiFiMACSim_CSMACAVCSListener_hpp
#define WiFiMACSim_CSMACAVCSListener_hpp

#include "Node.hpp"
#include "Message.hpp"
#include "Medium.hpp"
#include "Message.hpp"

SimNamespaceBegin





class	CSMACAVCSListener : public TransitionalStateMachineNode<CSMACAVCSListener>
{
public:
	
	enum {
		kStateIdle				=	0 ,
		
		kStateSendingCTS		=	101 ,
		kStateWaitForData		=	103 ,
		kStateSendingAck		=	105 ,
		
		kStateVCSSawRTS			=	2 ,
		kStateVCSSawCTS			=	3
	} ;
	
	
	SlotTimer	timer ;
	
	static const UInteger	Infinity	=	((UInteger)(-1)) ;
	
	ID			sender ;
	Message*	message ;
	
	
	
	
	CSMACAVCSListener ( ID const & name ) ;
	
	
	
	
	
	
	void	update_idle		( Message * incoming , bool completed , bool isBusy ) ;
	
	void	update_vcs_saw	( Message * incoming , bool completed , bool isBusy ) ;
	
	void	update_xmitCTS	( Message * incoming , bool completed , bool isBusy ) ;
	void	update_dataWait	( Message * incoming , bool completed , bool isBusy ) ;
	void	update_xmitAck	( Message * incoming , bool completed , bool isBusy ) ;
} ;



SimNamespaceEnd
#endif
